Skip to content

feat(pivot-grid): add EV charging network sample - #4090

Open
sdimchevski wants to merge 8 commits into
vnextfrom
pivot-ev-charging-sample
Open

sdimchevski wants to merge 8 commits into
vnextfrom
pivot-ev-charging-sample

Conversation

@sdimchevski

@sdimchevski sdimchevski commented Nov 29, 2026 •

Copy link
Copy Markdown

Pivot Grid: EV charging network sample

A new pivot grid sample, built from the "EV Charging Network Performance" design in Figma, in two routes:

  • pivot-grid-ev-charging: the full sample, with three saved views (Network overview, Tessera uptime by month, Motorway weekends), KPI cards, quick filter chips by power tier, and Excel export.
  • pivot-grid-ev-charging-docs: the grid only, proposed for the Pivot Grid docs page (1100 px column).

Public API only

  • Cell visuals via IPivotValue.styles + CSS:
    • a utilization data bar with a 25% capacity threshold line;
    • uptime status pills (flag / error icon, not colour alone);
    • an uptime heatmap;
    • ▲▼ trend vs the previous period;
    • total row and summary column tints.
  • Power tier chips call filterDimension().
  • RESET / LEGEND / FIELDS live in the grid's own igx-grid-toolbar (title + actions). FIELDS toggles an igx-pivot-data-selector next to the grid.
  • The cell styles legend opens over the grid on the first visit. When it closes, it shrinks into the LEGEND button (Web Animations API, respects prefers-reduced-motion).
  • --ig-size: small on the grid and data selector.
  • Colours are var(--ig-…) palette tokens, so the sample follows the docs theme switcher.

Data

  • src/app/data/ev-charging-data.ts: generated, flat records for 212 sites in 8 countries.
  • Dates are rebased at load, relative to today. The story always sits in the last complete quarter, so the sample never looks stale.
  • The "Energy delivered" and "Tessera downtime" KPI cards tick live (every 2 s).

Notes for review

  • The component uses ViewEncapsulation.None, because the IPivotValue.styles classes land on the grid's own cells. Every rule is scoped under app-pivot-ev-charging.
  • Country flags use the Twemoji Country Flags font (CC-BY 4.0, src/assets/fonts), because Windows has no flag emoji glyphs.
  • Live-editing configs were added for both components.
  • I couldn't run the full repo ng build in my environment because it ran out of memory. The sample was built and checked in a standalone app with the same Ignite UI version: no console errors, ESLint clean.

Figma: https://www.figma.com/design/9aNkFlSlD9IPOICQ3E7NcY

Adds a pivot grid sample built from the "EV Charging Network Performance"
Figma design, in two routes:
- pivot-grid-ev-charging: the full story (saved views, KPI cards, power tier
  quick filters, Excel export).
- pivot-grid-ev-charging-docs: the grid only, for the Pivot Grid docs page.

Everything uses public API: IPivotValue.styles for data bars, heatmap and
status pills, filterDimension for the chips, igx-grid-toolbar for the
Reset / Legend / Fields actions, igx-pivot-data-selector for the field list.
Colours are theme tokens, so the sample follows the docs theme switcher.
Dates are relative to today (last complete quarter).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QY5WYFKgexC47HYv1kcwNi
Replaces the hard-coded #fff (350 kW chip text, <93% heatmap text) with the
palette's -contrast tokens, drops the hex fallbacks, and sets the sample's
text colour (legend header, heatmap legend) from --ig-gray-900 instead of
inheriting the page colour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QY5WYFKgexC47HYv1kcwNi
…yles

- Selected power tier chips use their shade's contrast colour, so they stay readable in dark themes.
- Reset, Legend and See vendors keep primary text and primary state tints in every state.
- Cell styles select the IPivotValue.styles classes without the grid's internal classes; the header, buttons and icons go through public --ig-* tokens.
- Status and trend marks carry alt text for screen readers.
- Rules that never applied are removed and split rules are merged.
@desig9stein

desig9stein commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

@sdimchevski I pushed one commit to this branch (cfebeaa). It changes only pivot-ev-charging.component.scss. I pushed it instead of leaving review comments because most items are mechanical and each one was measured in the browser. Revert or amend anything you disagree with.

Why

  • Selected power tier chips fail contrast in all 4 dark themes.
  • Reset, Legend and See vendors show a pink (secondary) tint on hover and press, under blue text.
  • The styles reach into grid internals (.igx-grid__td) and component-local variables (--foreground, --header-background). The Ignite UI theming guidance uses the public --ig-* tokens for this.
  • Dead and split rules make the file hard to read.

Changes

  • Each power tier's selected text is its shade's contrast colour (--ig-info-100-contrast, --ig-info-300-contrast), as 350 kW already was. In dark themes, selected 50 kW goes from 1.29–1.79:1 to 11.22–15.61:1 and 150 kW from 1.95–3.4:1 to 5.91–10.28:1. Every chip state passes 4.5:1 in all 8 themes (lowest 5.18:1).
  • The flat primary buttons set foreground and state tints through --ig-flat-button-*. The toolbar derives the hover, focus and active tints from its secondary accent on the grid element, so overriding the button's foreground alone left them pink. Hover now darkens to primary-600 as the old rule declared; before, a plain color: rule overrode it.
  • Cell styles select the IPivotValue.styles classes directly (igx-pivot-grid .heat). The theme's cell rules sit inside @layer, so unlayered rules win without .igx-grid__td. The header uses --ig-grid-header-background, the FIELDS "on" state --ig-outlined-button-background/-hover-background, and icon sizes --ig-icon-size.
  • Removed rules that never applied: .sw.total and .qf-count (never rendered), a 28px swatch width that lost to a 40px rule, .hs:first-of-type (matched no element), gap: 0, flex on a grid item.
  • Status and trend marks have alt text, so screen readers read "Up 12.4%", "At risk 97.4%" and "Target missed" instead of "▲" and "flag".
  • One property per line, duplicate selectors merged. The FIELDS panel width is one variable shared by the panel and the legend offset.

How it was checked

  • Computed styles of every element in 8 states (three views, legend, FIELDS open, row selected, chip selected, button hovers), original vs this commit, each captured twice to rule out noise. No element box moved. The only differences are the button hover tint (pink to blue), the hover text (primary-500 to primary-600) and the pseudo-element alt text.
  • Button tints and chip contrast measured in all 8 themes through the sample's theme message.
  • npm run lint: 0 errors. npm run build: exits 0, no compile errors.

Not changed, needs your call

These fail WCAG AA contrast (4.5:1) and are the same in the original:

  • Dark themes: the "At risk" pill is 1.44–2.25:1 and heatmap shades 0–3 are 1.01–2.15:1.
  • "Target missed" pill and heat-4: 4.31:1 in Material, 2.69:1 in Fluent.
  • KPI change badges: 2.01–4.22:1 in Material, Fluent and Bootstrap.
  • Under-used data bar text (gray-600): 3.31–3.38:1 in Material, Fluent and Bootstrap light.

The 8.3:1 and 4.9:1 in the stylesheet comment hold for Indigo light only; I scoped the comment to that. Fixing these like the chips (contrast tokens) turns the coloured badge text black or white, so the design call is yours.

@desig9stein

desig9stein commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

@sdimchevski, @skrustev one structural suggestion, separate from the styling commit.

The docs sample (PivotEvChargingDocsComponent) renders PivotEvChargingComponent with the docs flag, which hides the page header, saved views, KPI cards and power tier chips. The docs page shows only the grid, but it carries all the code for the parts it hides:

  • The docs sample is what people copy. Readers open its code to learn how to style a pivot grid. Right now about 40% of the stylesheet and nearly half of the template is for things that page never shows, so they have to work out which parts matter. That's the main reason the sample exists, so it's worth getting right.

  • The cost is paid once and is moderate. The wiring between the two components is ordinary Angular: an input for the active view and a reference to the child grid for the chips and export. Svilen pays it once. Readers pay the confusion every time they open the sample.

  • It also makes the styling cleaner. The grid component's stylesheet would be about 350 lines of grid, toolbar, legend and cell styles. Each part would be easier to review, including the contrast issues still open on the pills and heatmap.

  • pivot-ev-charging.component.scss: the page header, KPI card and power tier chip sections take 253 of 605 lines (one flat-button rule in there is also used by the toolbar).

  • pivot-ev-charging.component.html: the two @if (!docs()) blocks are 59 of 127 lines.

  • kpis.ts only feeds the KPI cards.

The live-editing config for the docs sample lists all of these files, so a reader who opens the docs sample's code gets the header, KPI and chip code that the page never shows.

Suggestion: split it into two components.

  • A grid component with the pivot grid, toolbar, legend, FIELDS panel and cell styles. The docs sample uses it directly, and its live-editing config lists only its files plus the data and config files.
  • The full sample wraps the grid component and adds the header, saved views, KPI cards and chips with their own styles.

The docs input and both @if (!docs()) blocks go away, and no style is duplicated. The saved views would need an input on the grid component, since they switch the grid's configuration.

- Heatmap shades, status pills and KPI change badges use each shade's
  -contrast token for text (4.75:1 or more in all 8 themes; gray-900 and
  the coloured 500/800/900 text shades failed in dark, Material or Fluent).
- Secondary text (KPI labels, units, legend units, under-used values) goes
  from gray-600 to gray-700 (3.35:1 to 6:1 or more in the light themes).
- Over-threshold utilization keeps the orange bar, the value text stays
  default (warn-900 text was 1.4:1 in dark themes).
- Page title and KPI values use fixed sizes instead of h3/h2 tokens, which
  are twice as large in Material and Fluent and cut the energy value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QY5WYFKgexC47HYv1kcwNi
The red value (error-500) was 2.2-2.8:1 in Fluent and Indigo dark. The error
state stays visible through the red accent bar and the change badge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QY5WYFKgexC47HYv1kcwNi
The button had a custom primary-50 background when the data selector was
open, a state the outlined button does not have (and 1.3:1 text in dark
themes). The open panel shows the state; aria-pressed still reports it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QY5WYFKgexC47HYv1kcwNi
The value no longer turns red, so error cards also take error-500 as the
card outline (--ig-card-outline-color), next to the existing left accent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QY5WYFKgexC47HYv1kcwNi
The Fluent palette has no pale tints (success-50 and error-50 are its most
saturated shades, warn is gray), so the heatmap, the change badges and the
"target missed" pill came out neon there. Fluent-only rules, scoped with
@container style(--ig-theme: fluent): 99%+ gets no fill, missed targets take
error-200 and error-900, badges and the pill take the 500 shades with their
contrast text. The other themes are unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QY5WYFKgexC47HYv1kcwNi
@sdimchevski

sdimchevski commented Dec 1, 2026 •

Copy link
Copy Markdown
Author

@desig9stein Thanks for the fixes! On top of them: contrast fixes for all 8 themes, a neutral KPI value with a red card outline for errors, a plain outlined FIELDS button, and calmer Fluent-only colours via container style(--ig-theme: fluent).

@sdimchevski
sdimchevski requested review from skrustev and removed request for igdmdimitrov December 2, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants